package cn.dakaqi.dao.user;

import cn.dakaqi.entities.user.User;
import cn.dakaqi.utils.exception.ServiceRuntimeException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * Created by chunyang on 2016/4/7.
 */
public interface AccountDao extends PagingAndSortingRepository<User, Long>, JpaSpecificationExecutor<User> {

    Page<User> findByDelStatus(int delStatus, Pageable pageRequest) throws ServiceRuntimeException;

    User findByMobile(String mobile) throws ServiceRuntimeException;

    User findByEmail(String email) throws ServiceRuntimeException;

    User findById(int Id);

    User findByMobileOrEmail(String mobile,String email);

//	@Modifying
//	@Query("delete from Activity activity where activity.user.id=?1")
//	void deleteByUserId(Long id);
}